﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Diagnostics;
//using MongoDB.Driver;
//using ServiceManager.Services;

//namespace QuotationService.HistoryQuotation
//{
//    /// <summary>
//    /// 行情历史数据归档者
//    /// </summary>
//    public abstract class QuotationArchiver
//    {
//        /// <summary>
//        /// MongoDB的客户端实例
//        /// </summary>
//        protected MongoClient _MongoClient = null;

//        /// <summary>
//        /// 行情源类型
//        /// </summary>
//        public QuotationSource Source { get; private set; }

//        /// <summary>
//        /// 数据库名称
//        /// </summary>
//        public string DBName { get { return this.Source.ToString(); } }

//        /// <summary>
//        /// 构造器
//        /// </summary>
//        /// <param name="source"></param>
//        [DebuggerNonUserCode]
//        public QuotationArchiver(QuotationSource source)
//        {
//            this.Source = source;
//            _MongoClient = MongoService.GetOperatorClient(this.Source.ToString());
//        }

//        /// <summary>
//        /// 归档交易日信息
//        /// </summary>
//        /// <param name="tradeday"></param>
//        /// <returns></returns>
//        public bool Archive(ArchiverStatus tradeday)
//        {
//            ArchiverStatusCollection archiver = new ArchiverStatusCollection(this.Source, _MongoClient);
//            return archiver.Archive(tradeday);
//        }

//        /// <summary>
//        /// 取当前时间，格式:YYYYMMDDhhmmss
//        /// </summary>
//        /// <returns></returns>
//        private UInt64 GetDatetime()
//        {
//            DateTime now = DateTime.Now;
//            string temp = string.Format("{0:D4}{1:D2}{2:D2}{3:D2}{4:D2}{5:D2}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
//            return UInt64.Parse(temp);
//        }

//        /// <summary>
//        /// 释放资源
//        /// </summary>
//        public void Release()
//        {
//            if (_MongoClient != null)
//                MongoService.FreeOperatorClient();
//        }
//    }

//}
